import sys
import pygame

from settings import Settings
from ship import Ship
import game_functions as gf

def run_game():
  #初始化创建对象
  pygame.init()
  ai_settings = Settings()
  screen = pygame.display.set_mode(
    (ai_settings.screen_width,ai_settings.screen_height))
  #screen = pygame.display.set_mode((1200,800))
  pygame.display.set_caption('使用窗口')

  #创建一艘飞船
  ship = Ship(screen)

  #gb_color =(230,230,230)
  #开始游戏主循环
  while True:
    gf.check_events(ship)
    ship.update()
    gf.update_screen(ai_settings,screen,ship)
      # #监视鼠标键盘事件
      # for event in pygame.event.get():
      #   if event.type == pygame.QUIT:
      #     sys.exit()
    # screen.fill(ai_settings.bg_color)#重新配色
    # ship.blitme()
    #
    #
    # pygame.display.flip()#重绘屏幕课件

run_game()